<!-- 地址搜索组件 -->
<template>
    <el-row>
        <el-form inline>
            <inputs 
                v-hasPerm="['users:address:search']"
                labelWidth="70px"
                v-model="forms.user_name"
                label="用户名"/>
            <switchs 
                labelWidth="70px"
                v-hasPerm="['users:address:search']"
                v-model="forms.status"
                label="默认地址"/>
            <inputs 
                labelWidth="90px"
                v-hasPerm="['users:address:search']"
                v-model="forms.keys"
                label="搜索关键词"/>
            <daterange
                labelWidth="70px"
                label="添加时间"
                v-hasPerm="['users:address:search']"
                v-model:start_time="forms.start_time"
                v-model:end_time="forms.end_time"/>
            <el-form-item>
                <el-button
                    type="primary"
                    v-hasPerm="['users:address:search']"
                    icon="Search"
                    @click="handleQuery"
                    >搜索</el-button
                >
                <el-button
                    type="default"
                    icon="Plus"
                    v-hasPerm="['users:address:create']"
                    @click="createAddress"
                    >添加</el-button
                >
            </el-form-item>
        </el-form>
        <listCreate ref="listCreate" @refresh="handleQuery"/>
    </el-row>
</template>
<script>
import daterange from '@/components/form/item.daterange.vue'
import switchs from '@/components/form/item.switch.vue'
import inputs from '@/components/form/item.input.vue'
import listCreate from './list_create.vue'
export default{
    data(){
        return {
            is_default_list: [
                {label: "默认",value: 1},
                {label: "全部",value: 0},
            ],
            forms: {},
        }
    },
    methods: {
        // 搜索组件
        handleQuery(){
            this.$emit("query", this.forms)
        },
        // 添加地址组件
        createAddress(){
            this.$refs['listCreate'].Open()
        },
    },
    components: {
        daterange,
        switchs,
        inputs,
        listCreate,
    },
}
</script>